package cn.jia.hrm;

import cn.jia.hrm.vo.SMSSendVO;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;

import java.io.IOException;

import static cn.jia.hrm.common.MQConstants.NAME_QUEUE_HRM_SMS;

@Component
@Slf4j
public class MQHandler {
                            //队列
    @RabbitListener(queues = NAME_QUEUE_HRM_SMS,containerFactory = "rabbitListenerContainerFactory")
                                                                    //信道
    public void SMSHander(@Payload SMSSendVO vo , Message message, Channel channel) throws IOException {
        log.info(vo.getContent());
        channel.basicAck(message.getMessageProperties().getDeliveryTag(),false);
    }


}

